/*
*/

var AWS = require('aws-sdk');
AWS.config={
    accessKeyId: "",
    secretAccessKey: "",
	httpOptions:{proxy:''}
}
/* var s3 = new AWS.S3();
s3.listBuckets(function(err, data) {
	if(data)
  for (var index in data.Buckets) {
    var bucket = data.Buckets[index];
    console.log("Bucket: ", bucket.Name, ' : ', bucket.CreationDate);
  }
  else console.log(err)
}); */
UploadServer.init({
	tmpDir: '/bak/upload/',
	uploadDir: '/bak/upload/',
	checkCreateDirectories: true
});

import formidable from 'formidable'
upload2 = new formidable.IncomingForm();
upload2.uploadDir='/bak/upload';
Api = new Restivus();
Api.addRoute('upload2', {
	post: function () {
		request=this.request
			upload2.parse(request, function(err, fields, files) {
				Npm.require('fs').rename(files.file.path,'/bak/upload/'+files.file.name,function (err) {
				})
			});
		return true
	}
})
	BrowserPolicy.content.disallowInlineScripts()
	//BrowserPolicy.content.allowEval()
	BrowserPolicy.content.allowImageOrigin("*")
	BrowserPolicy.content.allowScriptOrigin('http://eco-api.meiqia.com')
	BrowserPolicy.content.allowFrameOrigin('http://eco-api.meiqia.com')
	//BrowserPolicy.content.allowOriginForAll('http://eco-api.meiqia.com')
import gm from 'gm'
gm('/cloud/360cloud/weiyun/kedo/public/img/bd_logo1.png')
.resize(240, 240)
.noProfile()
.write('/cloud/360cloud/weiyun/kedo/public/img/bd_logo1_resize.png', function (err) {

})